<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div id="print-page" class="container-fluid ms-container has-ms-sidemenu" style="display: none;">

  <div class="ms-content-layout" style="margin-top: 30px;">

    <div class="block-heading">
      <h5>公司状态信息</h5>
    </div>
    <div class="form-horizontal ms-form form-personal-info">
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">供方审核状态：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">
            ${supplier.status.description}
            <c:if test="${supplier.status.rejected}">
              &nbsp;&nbsp;<i class="text-danger">${supplierEvent.reason}</i>
            </c:if>
          </p>
        </div>
        
        <label class="control-label col-xs-2">挂靠管理公司：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">
            <c:forEach var="parent" items="${persist.parentSupplier(supplier)}">
              ${parent.code} - ${parent.name}<br/>
            </c:forEach>
          </p>
        </div>
      </div>

      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">公司类型：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${supplier.type.description}</p>
        </div>        
        
        <c:if test="${not empty supplier.syncStatus}">
          <label class="control-label col-xs-2">变更申报状态：</label>
          <div class="col-xs-3 pull-left">
            <p class="form-control-static">
              ${supplier.syncStatus.description}
              <c:if test="${supplier.syncStatus.rejected}">
                &nbsp;&nbsp;<i class="text-danger">${changeSupplierEvent.reason}</i>
              </c:if>
            </p>
          </div>
        </c:if>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">业务类型：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplier.businessTypeDescription ? '无' : supplier.businessTypeDescription}</p>
        </div>
        
        <label class="control-label col-xs-2">业务性质：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplier.businessNature ? '无' : supplier.businessNature.description}</p>
        </div>
      </div>
    </div>
  

    <div class="block-heading">
      <h5>公司基本信息</h5>
    </div>
    
    <div class="form-horizontal ms-form form-personal-info form-supplier-info">
    
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">1&nbsp;<span class="color-red">*</span>运输公司代码：</label>
        <div class="col-xs-3 pull-left">
            <p class="form-control-static">${supplier.code}</p>
        </div>
    
        <label class="control-label col-xs-3">2&nbsp;<span class="color-red">*</span>运输公司现用名(全称)：</label>
        <div class="col-xs-3 pull-left">
            <p class="form-control-static">${supplier.name}</p>
        </div>
      </div>
      
      <div class="form-group  ms-form-group">
        <label class="control-label col-xs-3">3.1&nbsp;运输公司曾用名I(全称)：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplierInfo.formerName ? '无' : supplierInfo.formerName}</p>
        </div>
        <label class="control-label col-xs-3">3.2&nbsp;运输公司曾用名II(全称)：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplierInfo.secondFormerName ? '无' : supplierInfo.secondFormerName}</p>
        </div>
      </div>
      
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">4&nbsp;<span class="color-red">*</span>董事长：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.chairman ? '无' : supplierInfo.chairman}</p>
          </div>
      </div>
    
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">5&nbsp;<span class="color-red">*</span>总经理：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.manager ? '无' : supplierInfo.manager}</p>
          </div>
          <label class="control-label col-xs-3">6&nbsp;<span class="color-red">*</span>总经理联系电话：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.managerPhone ? '无' : supplierInfo.managerPhone}</p>
          </div>
      </div>
    
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">7.1&nbsp;<span class="color-red">*</span>总经理Email&nbsp;I：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.managerEmail ? '无' : supplierInfo.managerEmail}</p>
          </div>
          <label class="control-label col-xs-3">7.2&nbsp;总经理Email&nbsp;II：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.secondManagerEmail ? '无' : supplierInfo.secondManagerEmail}</p>
          </div>
      </div>
    
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">8&nbsp;<span class="color-red">*</span>公司性质：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.companyProperty ? '无' : supplierInfo.companyDescription}</p>
          </div>
          <label class="control-label col-xs-3">9&nbsp;<span class="color-red">*</span>成立年月：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static"><fmt:formatDate value="${supplierInfo.yearFounded}" pattern="yyyy-MM"/></p>
          </div>
      </div>
    
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">10&nbsp;<span class="color-red">*</span>注册资金(万元)：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.registerCapital ? '无' : supplierInfo.registerCapital}</p>
          </div>
          <label class="control-label col-xs-3">11&nbsp;<span class="color-red">*</span>注册地：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierInfo.registerAddress ? '无' : supplierInfo.registerAddress}</p>
          </div>
      </div>
      
      <div class="form-group  ms-form-group">
        <label class="control-label col-xs-3">12&nbsp;<span class="color-red">*</span>联系地址：</label>
          <div class="col-xs-7 pull-left">
              <p class="form-control-static">${empty supplierInfo.contactAddress ? '无' : supplierInfo.contactAddress}</p>
          </div>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">13.1&nbsp;<span class="color-red">*</span>体系文件：</label>
        <div class="col-xs-9 pull-left">
          <p class="form-control-static">${empty supplierInfo.standardDocument ? '' : supplierInfo.standardDocumentString}</p>
        </div>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3">13.2&nbsp;<span class="color-red">*</span>体系文件有效期：</label>
        <div class="col-xs-7 pull-left">
          <p class="form-control-static">
            <fmt:formatDate value="${supplierInfo.standardDocumentDate}" pattern="yyyy-MM-dd"/>
          </p>
        </div>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-4">14.1&nbsp;<span class="color-red">*</span>营业执照原件扫描件有效日期：</label>
        <div class="col-xs-7 pull-left">
          <p class="form-control-static"><fmt:formatDate value="${supplierInfo.businessLicenseDate}" pattern="yyyy-MM-dd"/></p>
        </div>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-4">14.2&nbsp;道路运输许可证有效日期：</label>
        <div class="col-xs-7 pull-left">
          <p class="form-control-static"><fmt:formatDate value="${supplierInfo.transportCertDate}" pattern="yyyy-MM-dd"/></p>
        </div>
      </div>
      
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-4">15.1&nbsp;<span class="color-red">*</span>质量体系认证证书原件扫描件有效日期：</label>
        <div class="col-xs-7 pull-left">
          <p class="form-control-static"><fmt:formatDate value="${supplierInfo.qualitySystemDate}" pattern="yyyy-MM-dd"/></p>
        </div>
      </div>
    </div>

    <div id="anchor-supplier-certificate" class="block-heading">
      <h5>基本业务信息</h5>
    </div>
    
    <div class="form-horizontal ms-form form-personal-info form-supplier-info">
    
      <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">16&nbsp;<span class="color-red">*</span>管理人员(人)：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierCertificate.managerNum ? '无' : supplierCertificate.managerNum}</p>
          </div>
          <label class="control-label col-xs-3">17&nbsp;<span class="color-red">*</span>具体作业人员(人)：</label>
          <div class="col-xs-3 pull-left">
              <p class="form-control-static">${empty supplierCertificate.operatorNum ? '无' : supplierCertificate.operatorNum}</p>
          </div>
      </div>
    
      <div class="form-group ms-form-group">
          <label class="control-label col-xs-3 ">18&nbsp;<span class="color-red">*</span>公司规模(年预计销售收入)：</label>
          <div class="col-xs-3 pull-left">
            <p class="form-control-static">${empty supplierCertificate.companySizeString ? '无' : supplierCertificate.companySizeString}</p>
          </div>
      </div>
    
      <div class="form-group ms-form-group">
        <label class="control-label col-xs-3 ">19&nbsp;<span class="color-red">*</span>固定成本(元/板/年)：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplierCertificate.constantCost ? '无' : supplierCertificate.constantCost}</p>
        </div>
        <label class="control-label col-xs-3">20&nbsp;<span class="color-red">*</span>变动成本(元/板/公里)：</label>
        <div class="col-xs-3 pull-left">
          <p class="form-control-static">${empty supplierCertificate.variableCost ? '无' : supplierCertificate.variableCost}</p>
        </div>
      </div>
    </div>

    <div id="anchor-business-history" class="block-heading">
      <h5>过往业务信息</h5>
    </div>
    <table class="table table-hover ms-table" style="width: 90%;">
      <thead>
        <tr>
          <th>合同起止日期</th>
          <th>合同甲方</th>
          <th>合同乙方</th>
          <th>承运品牌</th>
          <th>出发地</th>
          <th>目的地</th>
          <th>投入运力板</th>
          <th>月均运量</th>
          <th>业务类型</th>
        </tr>
      </thead>
      
      <tbody>
        <c:forEach items="${supplierBusinessHistorys}" var="supplierBusinessHistory" varStatus="status"> 
          <tr>
            <td><fmt:formatDate value="${supplierBusinessHistory.startDate}" pattern="yyyy-MM-dd"/>&nbsp;&nbsp;-&nbsp;&nbsp;<fmt:formatDate value="${supplierBusinessHistory.endDate}" pattern="yyyy-MM-dd"/></td>
            <td>${supplierBusinessHistory.consignor}</td>
            <td>${supplierBusinessHistory.executor}</td>
            <td>${empty supplierBusinessHistory.brand ? '无' : supplierBusinessHistory.brand}</td>
            <td>${empty supplierBusinessHistory.fromLoadPlace ? '无' : supplierBusinessHistory.fromLoadPlace}</td>
            <td>${empty supplierBusinessHistory.toLoadPlace ? '无' : supplierBusinessHistory.toLoadPlace}</td>
            <td>${empty supplierBusinessHistory.vehicleNum ? '无' : supplierBusinessHistory.vehicleNum}</td>
            <td>${empty supplierBusinessHistory.averageCapacity ? '无' : supplierBusinessHistory.averageCapacity}</td>
            <td>${empty supplierBusinessHistory.transType.description ? '无' : supplierBusinessHistory.transType.description}</td>
          </tr>
        </c:forEach> 
      </tbody>
    </table>

    <div id="anchor-parking-resource" class="block-heading">
      <h5>停车场资源</h5>
    </div>
    
    <table class="table table-hover ms-table" style="width: 90%;">
      <thead>
        <tr>
          <th>位置</th>
          <th>面积</th>
          <th>场地来源</th>
          <th>到期日期</th>
        </tr>
      </thead>
      <tbody>
        <c:forEach items="${parkingResources}" var="parkingResource" varStatus="status"> 
          <tr>
            <td>${empty parkingResource.position ? '无' : parkingResource.position}</td>
            <td>
              <c:choose>
                <c:when test="${empty parkingResource.area}">无</c:when>
                <c:otherwise>
                  ${parkingResource.area}&nbsp;平方
                </c:otherwise>
              </c:choose>
            </td>
            <td>${empty parkingResource.fieldSource.description ? '无' : parkingResource.fieldSource.description}</td>
            <td><fmt:formatDate value="${parkingResource.expireDate}" pattern="yyyy-MM-dd"/></td>
          </tr>
        </c:forEach> 
      </tbody>
    </table>

    <div id="anchor-supplier-staff" class="block-heading">
      <h5>关键岗位信息（所有项目必填&nbsp;<span class="color-red">*</span>）</h5>
    </div>
    
    <table class="table table-hover ms-table" style="width: 90%;">
      <thead>
        <tr>
          <th style="width: 20%;">岗位\详细信息</th>
          <th>姓名</th>
          <th>电话</th>
          <th>手机</th>
          <th>Email</th>
          <th>QQ</th>
        </tr>
      </thead>
    
      <tbody>
        <c:forEach items="${enums['KeyPost'] }" var="keyPost">
          <c:set var="display" value="false" />
          <tr>
          
            <c:if test="${(keyPost.alias eq supplier.type.code) or (keyPost.alias eq '0')}">
    
              <td>${keyPost.description }</td>
    
              <c:forEach items="${supplierStaffs}" var="supplierStaff">
                <c:if test="${keyPost.description eq supplierStaff.keyPost.description}">
                  <td>${empty supplierStaff.name ? '无' : supplierStaff.name}</td>
                  <td>${empty supplierStaff.telephone ? '无' : supplierStaff.telephone}</td>
                  <td>${empty supplierStaff.mobile ? '无' : supplierStaff.mobile}</td>
                  <td>${empty supplierStaff.email ? '无' : supplierStaff.email}</td>
                  <td>${empty supplierStaff.tencent ? '无' : supplierStaff.tencent}</td>
                  <c:set var="display" value="true" />
                </c:if>
              </c:forEach>
    
              <c:if test="${not display}">
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
              </c:if>
    
            </c:if>
    
          </tr>
        </c:forEach>
      </tbody>
    </table>

    <div id="anchor-trasnport-resource" class="block-heading">
      <h5>运力资源</h5>
    </div>

    <div class="small-title" style="margin-top: 10px;">1&nbsp;牵引车</div>
    <table class="table table-hover ms-table " style="width: 90%;">
      <thead>
        <tr>
          <c:forEach items="${enums['PropertyType']}" var="property">
            <th>${property.description}</th>
          </c:forEach>
          <th>合计</th>
        </tr>
      </thead>

      <tbody>
        <tr>
          <c:set var="displayVehicle" value="false" />
          <c:forEach items="${transSupplierVehicleStats}" var="transSupplierVehicleStat">
            <c:if test="${transSupplierVehicleStat.vehicleType.alias eq 'truck'}">
              <c:set var="sum" value="${sum + transSupplierVehicleStat.amount}" />
              <td>${empty transSupplierVehicleStat.amount ? '0' : transSupplierVehicleStat.amount}</td>
              <c:set var="displayVehicle" value="true" />
            </c:if>
          </c:forEach>

          <c:if test="${not displayVehicle}">
            <td>无</td>
            <td>无</td>
            <td>无</td>
            <td>无</td>
            <td>无</td>
            <td>无</td>
          </c:if>

          <td>${empty sum ? '0':sum}</td>

          <c:set var="sum" value="0" />
          
        </tr>
      </tbody>
    </table>

    <div class="small-title" style="margin-top: 10px;">2&nbsp;挂车类型及满载量</div>
    <table class="table table-hover ms-table" style="width: 90%;">
      <thead>
        <tr>
          <th style="width: 15%;">挂车类型\满载量</th>
          <c:forEach items="${enums['CapacityType']}" var="capacityType">
            <th>${capacityType.description}</th>
          </c:forEach>
          <th>合计</th>
        </tr>
      </thead>

      <tbody>

        <c:forEach items="${enums['SupplierTrailerType']}" var="trailer">

          <c:set var="display" value="false" />

          <c:if test="${trailer.one}">
            <tr>

              <td>${trailer.description}</td>

              <c:forEach items="${transSupplierVehicleStats}" var="transSupplierVehicleStat">

                <c:if test="${trailer.alias eq transSupplierVehicleStat.trailerType.alias and transSupplierVehicleStat.trailerType.one}">
                  <td>${transSupplierVehicleStat.capacityTypeOne}</td>
                  <td>${transSupplierVehicleStat.capacityTypeTwo}</td>
                  <td>${transSupplierVehicleStat.capacityTypeThree}</td>
                  <td>${transSupplierVehicleStat.capacityTypeFour}</td>
                  <td>${transSupplierVehicleStat.capacityTypeFive}</td>
                  <td>${transSupplierVehicleStat.capacityTypeSix}</td>
                  <td>${transSupplierVehicleStat.capacityTypeSeven}</td>
                  <td>${transSupplierVehicleStat.capacityTypeEight}</td>
                  <td>${transSupplierVehicleStat.capacityTypeNine}</td>
                  <td>${transSupplierVehicleStat.capacityTypeOther}</td>
                  <td>${transSupplierVehicleStat.totals}</td>
                  <c:set var="display" value="true" />
                </c:if>

              </c:forEach>

              <c:if test="${not display}">
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>0</td>
              </c:if>

            </tr>
          </c:if>

        </c:forEach>

      </tbody>
    </table>

    <div class="small-title" style="margin-top: 10px;">3&nbsp;其他运力资源</div>
    <table class="table table-hover ms-table" style="width: 90%;">
      <thead>
        <tr>
          <c:forEach items="${enums['SupplierTrailerType']}" var="trailer">
            <c:if test="${trailer.code eq 'Two'}">
              <th>${trailer.description}</th>
            </c:if>
          </c:forEach>
        </tr>
      </thead>
      <tbody>
        <tr>
          <c:set var="displayOther" value="false" />
          <c:forEach items="${transSupplierVehicleStats}" var="transSupplierVehicleStat">
            <c:if test="${transSupplierVehicleStat.trailerType.code eq 'Two'}">
              <td>${empty transSupplierVehicleStat.amount ? '0':transSupplierVehicleStat.amount}</td>
              <c:set var="displayOther" value="true" />
            </c:if>
          </c:forEach>

          <c:if test="${not displayOther}">
            <td>无</td>
            <td>无</td>
            <td>无</td>
            <td>无</td>
          </c:if>
        </tr>
      </tbody>
    </table>

  </div>
</div>